<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理员登录</title>

<link href="/statics/css/main.css" rel="stylesheet" type="text/css" />

</head>
<body>


<div class="login">
    <div class="box png">
		<div class="logo png"></div>
		<div class="input">
			<div class="log">
				<div class="name">
					<label>用户名</label><input type="text" class="text" id="value_1" placeholder="用户名" name="value_1" tabindex="1">
				</div>
				<div class="pwd">
					<label>密　码</label><input type="password" class="text" id="value_2" placeholder="密码" name="value_2" tabindex="2">
					<input type="button" class="submit" tabindex="3" value="登录" onclick="login()">

				</div>
				<div id="tip" style="text-align: center; color: red"></div>
			</div>
		</div>
	</div>
    <div class="air-balloon ab-1 png"></div>
	<div class="air-balloon ab-2 png"></div>
    <div class="footer"></div>
</div>

<script type="text/javascript" src="/statics/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/statics/js/fun.base.js"></script>
<script type="text/javascript" src="/statics/js/script.js"></script>

<script>
    function login() {
        console.log('进来了')
        var username =$("#value_1").val();
        var password =$("#value_2").val();
        console.log(username)
        console.log(password)
            $.ajaxSetup({
                data:{csrfmiddlewaretoken:'{{ csrf_token }}'},
            });
       $.ajax({
           type:"post",
           url:"/loginVerify",
           dataType:"json",
           data:{"username":username,"password":password},
           success:function (data) {
             console.log("返回来了")
               if(data.success == 'success'){
                 console.log("成功了")
                 window.location.href="/loadview"
               }else if (data.error == 'fail'){
                 console.log("账号或密码错误")
                 document.getElementById("tip").innerHTML = "账号或密码错误"

               }
           },
       })

    }
</script>



<!--[if IE 6]>
<script src="js/DD_belatedPNG.js" type="text/javascript"></script>
<script>DD_belatedPNG.fix('.png')</script>
<![endif]-->

</body>
</html>